Skip to content

ColumnItemModel

Sub classes

Name Children Inherits
ImportlibTreeModel
prettyqt.itemmodels.importlibdistributionmodel
Model showing the dependency tree of a distribution.
    JsonModel
    prettyqt.itemmodels.jsonmodel
      BaseXmlModel
      prettyqt.itemmodels.xmlmodel
      PythonObjectTreeModel
      prettyqt.itemmodels.pythonobjecttreemodel

        Base classes

        Name Children Inherits
        ColumnItemModelMixin
        prettyqt.itemmodels.columnitemmodel
        TreeModel
        prettyqt.itemmodels.treemodel
        TreeModel which is used as a base for most TreeModels implemented.

        ⋔ Inheritance diagram

        graph TD
          3096575510["itemmodels.ColumnItemModel"]
          1030521844["itemmodels.ColumnItemModelMixin"]
          2751680898["builtins.object"]
          2846913429["itemmodels.TreeModel"]
          874904086["core.AbstractItemModel"]
          3882849576["core.AbstractItemModelMixin"]
          3227531497["core.ObjectMixin"]
          1898060022["QtCore.QAbstractItemModel"]
          3984060476["QtCore.QObject"]
          37984305["Shiboken.Object"]
          1030521844 --> 3096575510
          2751680898 --> 1030521844
          2846913429 --> 3096575510
          874904086 --> 2846913429
          3882849576 --> 874904086
          3227531497 --> 3882849576
          2751680898 --> 3227531497
          2751680898 --> 3882849576
          1898060022 --> 874904086
          3984060476 --> 1898060022
          37984305 --> 3984060476
          2751680898 --> 37984305

        🛈 DocStrings

        Bases: ColumnItemModelMixin, TreeModel

        TreeModel with columns defined by ColumnItem classes.

        Source code in prettyqt/itemmodels/columnitemmodel.py
        class ColumnItemModel(ColumnItemModelMixin, itemmodels.TreeModel):
            """TreeModel with columns defined by ColumnItem classes."""
        
            def __init__(
                self,
                obj=None,
                columns: Sequence[type[ColumnItem]] = (),
                mime_type: str | None = None,
                show_root: bool = True,
                **kwargs,
            ):
                # columns need to be available before the TreeModel fetches the root.
                self.mime_type = mime_type
                self.set_columns(columns)
                super().__init__(obj=obj, show_root=show_root, **kwargs)
        
            def columnCount(self, parent: core.ModelIndex | None = None) -> int:
                return len(self._attr_cols)
        

        :fa-brands-github: Show source on GitHub